#!/usr/bin/perl 

use strict;

use DBI;
use CGI;
use TTraker;

my $dbh;
initialize_dbi();
# my $form_ref = parse_input();
my $start = "2012-01-10";
my $dates_ref = get_all_payroll_dates_used($start);
my @dates = @$dates_ref;
my $date;
my $loc = "TOR";
$| = 1;
foreach $date ( @dates ) {
#	if ( $date eq "2010-12-28" ) {
		print "$date calculating... ";
		update_job_event_elapsed_adj_all_loc ($date);
		update_job_headers_time_cost_all_loc ($date);	
		print "updating... ";
		update_daily_from_payroll_list_all_loc  ($date);
		print "reporting... ";		
		fill_rpt_daily_data_adjusted ($date, $loc);
		print "history... ";
		fill_history_tables ($date);
		print "sleeping \n";
#		sleep 2;
#	}
}
db_disconnect();


